import request from '@/utils/request'

// 查询编码规则列表
export function listCodeRule(query) {
  return request({
    url: '/sys/codeRule/list',
    method: 'get',
    params: query
  })
}

// 查询编码规则详细
export function getCodeRule(id) {
  return request({
    url: '/sys/codeRule/' + id,
    method: 'get'
  })
}
// 获取编码
export function getCode(bizCode,date) {
  var dateWhere = '';
  if (date != undefined && date != null && date != '') {
    dateWhere = '&date=' + date;
  }
  return request({
    url: '/sys/codeRule/getCode/?bizCode=' + bizCode + dateWhere,
    method: 'get'
  })
}

// 新增编码规则
export function addCodeRule(data) {
  return request({
    url: '/sys/codeRule',
    method: 'post',
    data: data
  })
}

// 修改编码规则
export function updateCodeRule(data) {
  return request({
    url: '/sys/codeRule',
    method: 'put',
    data: data
  })
}

// 删除编码规则
export function delCodeRule(id) {
  return request({
    url: '/sys/codeRule/' + id,
    method: 'delete'
  })
}
